package com.tywj.buscustomerapp.view.fragment;

import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.tywj.buscustomerapp.R;
import com.tywj.buscustomerapp.presenter.BasePresenter;
import com.tywj.buscustomerapp.view.activity.WebActivity;
import com.umeng.analytics.MobclickAgent;

import butterknife.BindView;


public class TourismFragment extends BaseMvpFragment {
    @BindView(R.id.error_null_btn)
    TextView btn;

    private static TourismFragment fragment = new TourismFragment();
    public static TourismFragment getInstance() {
        return fragment;
    }

    @Override
    public int getLayoutResId() {
//        return R.layout.tourism_tlayout;
        return R.layout.fragment_nothing;
    }

    @Override
    public void initView(View view) {
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                Intent intent = new Intent(fragment.getContext(),WebActivity.class);
//                intent.putExtra("url","https://cashier.cytong.cn/?orderNo=190121173154321792&code=021t4Wua0rRk3z1iX8sa0J5Uua0t4Wuc&state=NONE");
//                fragment.getContext().startActivity(intent);

//                Intent intent = new Intent(Intent.ACTION_MAIN);
//                ComponentName cmp = new ComponentName("com.tencent.mm","com.tencent.mm.ui.LauncherUI");
//                intent.addCategory(Intent.CATEGORY_LAUNCHER);
//                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                intent.setComponent(cmp);
//                startActivity(intent);

//                String guanzhu_URL = "http://agency.cytong.cn/sale/cn9yobwb";
//                i.setData(Uri.parse(guanzhu_URL));
//                i.setPackage("com.tencent.mm");
//                i.putExtra(Intent.EXTRA_SUBJECT,"Share");
//                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                startActivity(i);
            }
        });
//        apps.add(new TourismApp("景区门票",R.mipmap.ico2));
//        apps.add(new TourismApp("演出票",R.mipmap.ico4));
//        apps.add(new TourismApp("跟团游",R.mipmap.ico7));
//        apps.add(new TourismApp("酒店客栈",R.mipmap.ico8));
//        appRecycler.setLayoutManager(new GridLayoutManager(getContext(),4));
//        appAdapter = new CommonRcvAdapter<TourismApp>(apps) {
//            @NonNull
//            @Override
//            public AdapterItem createItem(Object type) {
//                return new TourismItem();
//            }
//        };
//        appRecycler.setAdapter(appAdapter);
//        appAdapter.setData(apps);
//        appAdapter.notifyDataSetChanged();
//        List<BroastBean> broastBeans = new ArrayList<>();
//        for (int i = 0; i < 3; i++) {
//            BroastBean bean = new BroastBean();
//            bean.setType("通知");
//            bean.setTitle(i+"巴拉巴拉吧吧啦啦啦啦啦啦啦啦啦啦啦阿拉啦啦爱啦啦啦");
//            broastBeans.add(bean);
//        }
//        recyclerView.setLayoutFrozen(true);
//        pagerAdapter = new AutoViewPagerViewAdapter(getContext(),broastBeans);
//        broast.setAdapter(pagerAdapter);
//        initClick();
    }

    private void initClick() {
//        moreScenic.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                startActivity(new Intent(getActivity(), HotScenicActivity.class));
//            }
//        });
    }

    @Override
    public void initData() {
//        for (int i = 0; i < 6; i++) {
//            PandaSelectBean panda= new PandaSelectBean("熊猫基地"+i,"78","199",5,"222");
//            selectBeans.add(panda);
//        }
//
//        selectAdapter = new CommonRcvAdapter<PandaSelectBean>(selectBeans) {
//            @NonNull
//            @Override
//            public AdapterItem createItem(Object type) {
//                return new PandaSelectItem();
//            }
//        };
//        recyclerView.setAdapter(selectAdapter);
//        recyclerView.setLayoutManager(new GridLayoutManager(getContext(),2));
//        selectAdapter.setData(selectBeans);
//        selectAdapter.notifyDataSetChanged();
    }



    @Override
    protected BasePresenter bindPresenter() {
        return null;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
    @Override
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart("主页—自由行");
    }

    @Override
    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd("主页-自由行");
    }
}
